<?php
/*
 * @Descripttion: 
 * @version: 
 * @Author: Eugene
 * @Date: 2023-06-30 18:04:26
 * @LastEditors: Andy
 * @LastEditTime: 2023-07-03 10:38:14
 */

namespace app\common\model\order;

use think\Model;


class Goods extends Model
{

    // 表名
    protected $name = 'order_goods';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'image_str',
    ];
    public function getImageStrAttr($value, $data)
    {
        if (isset($data['image']) && $data['image']) {
            return cdnurl($data['image'], true);
        }
        return '';
    }
    public function order()
    {
        return $this->belongsTo('app\common\model\Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
